﻿using System.Data.Entity;
using Model.BusinessLogic.PhysicalData;

namespace Model.BusinessLogic
{
    /// <summary>
    ///     TODO:可以提到BML中，但是后续的关联将受到影响。反射生成 自定义的属性
    ///     模型容器：将需要和数据库建立关联的模型放入该类中
    /// </summary>
    public class ModelContainer : DbContext
    {
        public ModelContainer()
            : base("BusinessLogicConnStr")
        {
        }

        #region Example:public DbSet<YourClassName> yourclassname { get; set; }

        public DbSet<Tag> Tags { get; set; }
        
        #endregion

        /*
		/// <summary>
		/// 关闭级联
		/// </summary>
		/// <param name="modelBuilder"></param>
		protected override void OnModelCreating(DbModelBuilder modelBuilder)
		{
			modelBuilder.Conventions.Remove<OneToManyCascadeDeleteConvention>();
			modelBuilder.Conventions.Remove<ManyToManyCascadeDeleteConvention>();
		}
		*/
    }
}